/**
 * Created by xmgong on 2017/10/25.
 */

import React from 'react';
import {View, Text} from 'react-native';
import moment from 'moment';
import themecofig from '../../config/theme';
class TransationItem extends React.Component {
    render() {

        let rowData = this.props.rowData;

        let type = '';
        let txtcolor = '';
        let price = '';
        if (rowData.inAmount > 0) {
            type = '进账';
            txtcolor = '#ff0000';
            price = '+¥' + (rowData.inAmount / 100).toFixed(2) + '元';
        } else {
            type = '出账';
            txtcolor = '#1a9b3b';
            price = '-¥' + (rowData.outAmount / 100).toFixed(2) + '元';
        }
        let applydate = '';
        applydate = moment.unix(rowData.createdAt / 1000).format("YYYY/MM/DD");


        return (
            <View style={{
                flex: 1,
                flexDirection: 'column',
                paddingLeft: 20,
                paddingRight: 20,
                paddingTop: 10,
                paddingBottom: 10,
                backgroundColor: 'white'
            }}>
                <View style={{flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between',}}>
                    <Text style={{fontSize: 16}}>{type}</Text>
                    <Text style={{fontSize: 20, color: txtcolor}}> {price} </Text>
                </View>
                <Text style={{marginTop: 10, fontSize: 16}}>{rowData.remark}</Text>
                <Text style={{marginTop: 10, fontSize: 16}}>{applydate}</Text>
            </View>
        );
    }
}


export default TransationItem;
